search last visible column instead of using clist->columns.
authorLars Hamann <lars@gtk.org>
Sat, 6 Feb 1999 00:21:56 +0000 (00:21 +0000)
committerLars Hamann <lars@src.gnome.org>
Sat, 6 Feb 1999 00:21:56 +0000 (00:21 +0000)
Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>

* gtk/gtkctree.c (draw_row):
* gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
(title_focus): search last visible column instead of
using clist->columns.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkclist.c
gtk/gtkctree.c

index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index ff2bf351dfa70a0e60d40fd27c45797cdac3cff8..8029fae544af1ba1f0e3b16f905e6a0d5b98f654 100644 (file)
@@ -1,3 +1,10 @@
+Sat Feb  6 00:21:14 1999  Lars Hamann  <lars@gtk.org>
+
+       * gtk/gtkctree.c (draw_row): 
+       * gtk/gtkclist.c (draw_row) (new_column_width) (scroll_horizontal)
+       (title_focus): search last visible column instead of
+       using clist->columns.
+
 Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
index 327f873e98840ac6044a214b9847dc291d846a04..fb80fcccd97782a5022b19be1bfe68802a1abace 100644 (file)
@@ -2069,10 +2069,7 @@ list_requisition_width (GtkCList *clist)
   gint width = CELL_SPACING;
   gint i;
 
-  for (i = clist->columns - 1; i >= 0 && !clist->column[i].visible; i--)
-    ;
-
-  for (; i >= 0; i--)
+  for (i = clist->columns - 1; i >= 0; i--)
     {
       if (!clist->column[i].visible)
        continue;
@@ -2098,15 +2095,19 @@ new_column_width (GtkCList *clist,
   gint width;
   gint cx;
   gint dx;
+  gint last_column;
 
   /* first translate the x position from widget->window
    * to clist->clist_window */
   cx = *x - xthickness;
 
+  for (last_column = clist->columns - 1;
+       last_column >= 0 && !clist->column[last_column].visible; last_column--);
+
   /* calculate new column width making sure it doesn't end up
    * less than the minimum width */
   dx = (COLUMN_LEFT_XPIXEL (clist, column) + COLUMN_INSET +
-       (column < clist->columns - 1) * CELL_SPACING);
+       (column < last_column) * CELL_SPACING);
   width = cx - dx;
 
   if (width < MAX (COLUMN_MIN_WIDTH, clist->column[column].min_width))
@@ -5648,6 +5649,7 @@ draw_row (GtkCList     *clist,
   GdkRectangle cell_rectangle;
   GdkRectangle clip_rectangle;
   GdkRectangle intersect_rectangle;
+  gint last_column;
   gint state;
   gint i;
 
@@ -5753,6 +5755,10 @@ draw_row (GtkCList     *clist,
        }         
     }
   
+  for (last_column = clist->columns - 1;
+       last_column >= 0 && !clist->column[last_column].visible; last_column--)
+    ;
+
   /* iterate and draw all the columns (row cells) and draw their contents */
   for (i = 0; i < clist->columns; i++)
     {
@@ -5777,7 +5783,7 @@ draw_row (GtkCList     *clist,
       /* calculate clipping region clipping region */
       clip_rectangle.x -= COLUMN_INSET + CELL_SPACING;
       clip_rectangle.width += (2 * COLUMN_INSET + CELL_SPACING +
-                              (i + 1 == clist->columns) * CELL_SPACING);
+                              (i == last_column) * CELL_SPACING);
       
       if (area && !gdk_rectangle_intersect (area, &clip_rectangle,
                                            &intersect_rectangle))
@@ -5788,7 +5794,7 @@ draw_row (GtkCList     *clist,
 
       clip_rectangle.x += COLUMN_INSET + CELL_SPACING;
       clip_rectangle.width -= (2 * COLUMN_INSET + CELL_SPACING +
-                              (i + 1 == clist->columns) * CELL_SPACING);
+                              (i == last_column) * CELL_SPACING);
 
       /* calculate real width for column justification */
       pixmap_width = 0;
@@ -6701,6 +6707,7 @@ title_focus (GtkCList *clist,
 {
   GtkWidget *focus_child;
   gboolean return_val = FALSE;
+  gint last_column;
   gint d = 1;
   gint i = 0;
   gint j;
@@ -6709,6 +6716,10 @@ title_focus (GtkCList *clist,
     return FALSE;
 
   focus_child = GTK_CONTAINER (clist)->focus_child;
+
+  for (last_column = clist->columns - 1;
+       last_column >= 0 && !clist->column[last_column].visible; last_column--)
+    ;
   
   switch (dir)
     {
@@ -6719,7 +6730,7 @@ title_focus (GtkCList *clist,
          if (dir == GTK_DIR_UP)
            i = COLUMN_FROM_XPIXEL (clist, 0);
          else
-           i = clist->columns - 1;
+           i = last_column;
          focus_child = clist->column[i].button;
          dir = GTK_DIR_TAB_FORWARD;
        }
@@ -6730,7 +6741,7 @@ title_focus (GtkCList *clist,
       d = -1;
       if (!focus_child)
        {
-         i = clist->columns - 1;
+         i = last_column;
          focus_child = clist->column[i].button;
        }
       break;
@@ -6798,7 +6809,7 @@ title_focus (GtkCList *clist,
       else if (COLUMN_LEFT_XPIXEL(clist, j) + clist->column[j].area.width >
               clist->clist_window_width)
        {
-         if (j == clist->columns-1)
+         if (j == last_column)
            gtk_clist_moveto (clist, -1, j, 0, 0);
          else
            gtk_clist_moveto (clist, -1, j, 0, 1);
@@ -6884,6 +6895,7 @@ scroll_horizontal (GtkCList      *clist,
                   gfloat         position)
 {
   gint column = 0;
+  gint last_column;
 
   g_return_if_fail (clist != 0);
   g_return_if_fail (GTK_IS_CLIST (clist));
@@ -6891,6 +6903,10 @@ scroll_horizontal (GtkCList      *clist,
   if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
     return;
 
+  for (last_column = clist->columns - 1;
+       last_column >= 0 && !clist->column[last_column].visible; last_column--)
+    ;
+
   switch (scroll_type)
     {
     case GTK_SCROLL_STEP_BACKWARD:
@@ -6900,13 +6916,13 @@ scroll_horizontal (GtkCList      *clist,
        column--;
       break;
     case GTK_SCROLL_STEP_FORWARD:
-      column =  COLUMN_FROM_XPIXEL (clist, clist->clist_window_width);
+      column = COLUMN_FROM_XPIXEL (clist, clist->clist_window_width);
       if (column < 0)
        return;
       if (COLUMN_LEFT_XPIXEL (clist, column) +
          clist->column[column].area.width +
          CELL_SPACING + COLUMN_INSET - 1 <= clist->clist_window_width &&
-         column < clist->columns - 1)
+         column < last_column)
        column++;
       break;
     case GTK_SCROLL_PAGE_BACKWARD:
@@ -6914,7 +6930,22 @@ scroll_horizontal (GtkCList      *clist,
       return;
     case GTK_SCROLL_JUMP:
       if (position >= 0 && position <= 1)
-       column = position * (clist->columns - 1);
+       {
+         gint vis_columns = 0;
+         gint i;
+
+         for (i = 0; i <= last_column; i++)
+           if (clist->column[i].visible)
+             vis_columns++;
+
+         column = position * vis_columns;
+
+         for (i = 0; i <= last_column && column > 0; i++)
+           if (clist->column[i].visible)
+             column--;
+
+         column = i;
+       }
       else
        return;
       break;
@@ -6927,7 +6958,7 @@ scroll_horizontal (GtkCList      *clist,
   else if (COLUMN_LEFT_XPIXEL (clist, column) + CELL_SPACING + COLUMN_INSET - 1
           + clist->column[column].area.width > clist->clist_window_width)
     {
-      if (column == clist->columns - 1)
+      if (column == last_column)
        gtk_clist_moveto (clist, -1, column, 0, 0);
       else
        gtk_clist_moveto (clist, -1, column, 0, 1);
index da4b2c6610749522673a2b81483fb68488d38a33..bcc464f8403db8f85544f7f449ed90ad259c09d9 100644 (file)
@@ -1580,6 +1580,7 @@ draw_row (GtkCList     *clist,
   GdkRectangle cell_rectangle; 
   GdkRectangle clip_rectangle;
   GdkRectangle intersect_rectangle;
+  gint last_column;
   gint column_left = 0;
   gint column_right = 0;
   gint offset = 0;
@@ -1729,6 +1730,10 @@ draw_row (GtkCList     *clist,
        }
     }    
 
+  for (last_column = clist->columns - 1;
+       last_column >= 0 && !clist->column[last_column].visible; last_column--)
+    ;
+
   /* iterate and draw all the columns (row cells) and draw their contents */
   for (i = 0; i < clist->columns; i++)
     {
@@ -1754,7 +1759,7 @@ draw_row (GtkCList     *clist,
 
       cell_rectangle.x = clip_rectangle.x - COLUMN_INSET - CELL_SPACING;
       cell_rectangle.width = (clip_rectangle.width + 2 * COLUMN_INSET +
-                             (1 + (i + 1 == clist->columns)) * CELL_SPACING);
+                             (1 + (i == last_column)) * CELL_SPACING);
       cell_rectangle.y = clip_rectangle.y;
       cell_rectangle.height = clip_rectangle.height;